import moduleRegist from '@/utils/moduleRegist';
import {
  module as orderpayerModule
} from './module';
// import {
//   module as orderpayerItemsModule
// } from '../orderpayerItems/module';

const BlanketOrder = resolve => {
  require(['./BlanketOrder'], resolve);
};

const Layout = resolve => {
  require(['./Layout'], resolve);
};

const ChildOrder = resolve => {
  require(['./ChildOrder'], resolve);
};

const RefundOrder = resolve => {
  require(['./RefundOrder'], resolve);
};

const DataStatistics = resolve => {
  require(['./DataStatistics'], resolve);
};

const DetailForm = resolve => {
  require(['./DetailForm'], resolve);
};

export default [
  /** 配置管理路由 */
  {
    path: 'orderCenter',
    redirect: 'orderCenter/dataStatistics',
    component: Layout,
    meta: {
      title: '订单中心',
      name: '订单中心',
      permission: '',
      componentName: 'OrderpayerLayout',
      keepAlive: true,
      icon: 'md-people',
      show: false
    },
    beforeEnter: (to, from, next) => {
      moduleRegist(orderpayerModule);
      //moduleRegist(taxpayerItemsModule);
      next();
    },
    children: [
      {
        path: 'dataStatistics',
        component: DataStatistics,
        meta: {
          title: '数据统计',
          name: '数据统计',
          breadcrumb: '数据统计',
          permission: 'invoice:taxpayer:add',
          show: true,
          keepAlive: true,
          componentName: 'OrderpayerAddView',
          icon: ''
        }
      },
      {
        path: 'blanketOrder',
        component: BlanketOrder,
        meta: {
          title: '订单列表',
          name: '总订单查询',
          breadcrumb: '订单列表',
          permission: 'invoice:taxpayer:query',
          keepAlive: true,
          componentName: 'OrderpayerListView',
          icon: ''
        }
      },
      {
        path: 'detailForm',
        component: DetailForm,
        meta: {
          title: '总订单详情',
          name: '总订单详情',
          breadcrumb: '总订单详情',
          permission: 'invoice:taxpayer:query',
          keepAlive: true,
          show: true,
          componentName: 'OrderpayerListView',
          icon: ''
        }
      },
      {
        path: 'cDetailForm',
        component: DetailForm,
        meta: {
          title: '子订单详情',
          name: '子订单详情',
          breadcrumb: '子订单详情',
          permission: 'invoice:taxpayer:query',
          keepAlive: true,
          show: true,
          componentName: 'OrderpayerListView',
          icon: ''
        }
      },
      {
        path: 'rDetailForm',
        component: DetailForm,
        meta: {
          title: '退款订单详情',
          name: '退款订单详情',
          breadcrumb: '退款订单详情',
          permission: 'invoice:taxpayer:query',
          keepAlive: true,
          show: true,
          componentName: 'OrderpayerListView',
          icon: ''
        }
      },
      {
        path: 'childOrder',
        component: ChildOrder,
        meta: {
          title: '子订单查询',
          name: '子订单查询',
          breadcrumb: '子订单查询',
          permission: 'invoice:taxpayer:add',
          show: true,
          keepAlive: true,
          componentName: 'OrderpayerAddView',
          icon: ''
        }
      },
      {
        path: 'refundOrder',
        component: RefundOrder,
        meta: {
          title: '退款订单查询',
          name: '退款订单查询',
          breadcrumb: '退款订单查询',
          permission: 'invoice:taxpayer:detail',
          show: true,
          keepAlive: true,
          componentName: 'OrderpayerDetailView',
          icon: ''
        }
      }
    ]
  }
];
